package com.zhou.common.operator.log.web.req;

import com.zhou.common.operator.log.core.model.ClientInfo;
import com.zhou.common.operator.log.core.model.OperateLogInfo;
import com.zhou.common.operator.log.core.model.PayloadInfo;
import com.zhou.common.operator.log.core.model.PrincipalInfo;

public class OperateLogInfoRequestConverter {

    public static OperateLogInfo operateLogRequestConveter(OperateLogRecordRequest operateLogRecord) {
        OperateLogInfo operateLogInfo = new OperateLogInfo();
        ClientInfo clientInfo = new ClientInfo();
        clientInfo.setClientIp(operateLogRecord.getClientIp());
        clientInfo.setBrowser(operateLogRecord.getBrowser());
        clientInfo.setBrowserVersion(operateLogRecord.getBrowserVersion());
        clientInfo.setServerIp(operateLogRecord.getServerIp());
        clientInfo.setOs(operateLogRecord.getOs());
        clientInfo.setMacAddress(operateLogRecord.getMacAddress());
        operateLogInfo.setClientInfo(clientInfo);
        operateLogInfo.setBusinessId(operateLogRecord.getBusinessId());
        PayloadInfo payloadInfo = new PayloadInfo();
        operateLogInfo.setPayloadInfo(payloadInfo);
        PrincipalInfo principalInfo = new PrincipalInfo();
        principalInfo.setOrgId(operateLogRecord.getOrgId());
        principalInfo.setOrgName(operateLogRecord.getOrgName());
        principalInfo.setUserName(operateLogRecord.getUserName());
        principalInfo.setUserPhone(operateLogRecord.getUserPhone());
        principalInfo.setUserId(operateLogRecord.getUserId());
        operateLogInfo.setPrincipal(principalInfo);
        operateLogInfo.setAction(operateLogRecord.getAction());
        operateLogInfo.setResource(operateLogRecord.getResource());
        operateLogInfo.setRemark(operateLogRecord.getRemark());
        operateLogInfo.setId(operateLogRecord.getId());
        operateLogInfo.setOperatingSystem(operateLogRecord.getOperatingSystem());
        operateLogInfo.setOperatingInstruction(operateLogRecord.getOperatingInstruction());
        operateLogInfo.setOperatingType(operateLogRecord.getOperatingType());
        operateLogInfo.setOperatingModule(operateLogRecord.getOperatingModule());
        return operateLogInfo;
    }
}

